home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / CONSTRAI / PROVIDER.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.2 KB  |  78 lines

  1.  
  2. package sub_arctic.constraints;
  3.  
  4. /** 
  5.  * A small class to encapsulate a <value_provider, part_number> pair. 
  6.  *
  7.  * @author Scott Hudson
  8.  */
  9. public class provider_part_ref {
  10.  
  11.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  12.  
  13.   /** The provider object. */
  14.   public value_provider obj;
  15.  
  16.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  17.  
  18.   /** The part number of that object that we refer to */
  19.   public int part_num;
  20.  
  21.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  22.  
  23.   /** 
  24.    * Constructor. 
  25.    *
  26.    * @param value_provider o  the object providing the value.
  27.    * @param int            pn the number of the part within the object which 
  28.    *                          provides the value.
  29.    */
  30.   public provider_part_ref(value_provider o, int pn)
  31.     {
  32.       obj = o;
  33.       part_num = pn;
  34.     }
  35.  
  36.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  37.  
  38.   /** Hash code so we can put these in hash tables. */
  39.   public int hashCode()
  40.     {
  41.       return obj.hashCode() ^ part_num;
  42.     }
  43.  
  44.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  45.  
  46.   /** Comparison operator. */
  47.   public boolean equals(Object other)
  48.     {
  49.       provider_part_ref other_one;
  50.  
  51.       /* not equal to anything of the wrong type */
  52.       if (!(other instanceof provider_part_ref)) return false;
  53.  
  54.       /* convert and test */
  55.       other_one = (provider_part_ref)other;
  56.       return other_one.obj == obj && other_one.part_num == part_num;
  57.     }
  58.  
  59.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  60. }
  61.  
  62. /*=========================== COPYRIGHT NOTICE ===========================
  63.  
  64. This file is part of the subArctic user interface toolkit.
  65.  
  66. Copyright (c) 1996 Scott Hudson and Ian Smith
  67. All rights reserved.
  68.  
  69. The subArctic system is freely available for most uses under the terms
  70. and conditions described in 
  71.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  72. and appearing in full in the lib/interactor.java source file.
  73.  
  74. The current release and additional information about this software can be 
  75. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  76.  
  77. ========================================================================*/
  78.